<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>登录小案例</title>
  <script src="../js/vue.min.js"></script>
</head>

<body>
  <div id ="app"> 
    <span v-if='isUser'>
      <label for="userName">用户账号：</label>
      <input type="text" id="userName"  placeholder="请输入用户账号"/>
    </span>
    <span v-else>
      <label for="email">用户邮箱：</label>
      <input type="text" id="email" placeholder="请输入用户邮箱" />
    </span>
    <button @click='changeType()'>切换类型</button>
  </div>

  <script>
   var vm = new Vue({
    el: '#app',
    data: {
      isUser: true,
    },
    methods: {
      changeType() {
        this.isUser = !this.isUser;
      }
    }
   });
  </script>
</body>

</html>